import {Component, OnInit} from '@angular/core';
import {Router, ActivatedRoute, ParamMap } from '@angular/router';

@Component({
  selector: 'app-second',
  templateUrl: './second.component.html',
  styleUrls: ['./second.component.scss']
})
export class SecondComponent implements OnInit {
  name: string;

  constructor(
    private route: ActivatedRoute,
  ) {
  }

  ngOnInit() {
    // 获取params传值
    this.route.queryParams.subscribe(params => {
      console.log(params);
      this.name = params['name'];
    });
  }

}
